<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body" style="padding: 15px;">
        <form name="addItem" method="post" lay-filter="component-form-group" class="layui-form">
        <div class="layui-form-item">
            <textarea  id="demo" name="content" lay-verify="content" placeholder="<!--{$lang.page.public.pinput}-->" class="layui-textarea"></textarea>
        </div>
   
          <div class="layui-form-item layui-layout-admin">
            <div>
              <div style="text-align: center;">
                <button class="layui-btn" id="sontodad" lay-submit lay-filter="submit"><!--{$lang.page.public.submit}--></button>
                <button type="button" class="layui-btn layui-btn-primary" onClick="xadmin.close();" ><!--{$lang.page.table.back}--></button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
<script src="/static/lay/layui/layui.js"></script>
  <script type="text/javascript">
    // 获取父页面参数
    window.child = function(param){
      document.getElementById('demo').value=param;
      layui.config({
          base: '/static/lay/' //静态资源所在路径
      }).extend({
          xadmin: 'lib/xadmin' //弹窗
      }).use(['jquery', 'layer','xadmin', 'form', 'element','layedit'], function(){
        var $ = layui.$;
        var form = layui.form;
        form.render(null, 'component-form-group');
        var layer = layui.layer;
        var layedit = layui.layedit;
        layedit.set({
            uploadImage: {
                url: '/content/common/editor_upload_img/'
                ,type: 'post' //默认post
            }
        });
        content=layedit.build('demo',{tool: [
            'strong' //加粗
            ,'italic' //斜体
            ,'underline' //下划线
            ,'del' //删除线
            ,'|' //分割线
            ,'left' //左对齐
            ,'center' //居中对齐
            ,'right' //右对齐
            ,'link' //超链接
            ,'unlink' //清除链接
            ,'face' //表情
            ,'image' //插入图片
            ,'code'
            ,'help' //帮助
        ]}); //建立编辑器
        form.verify({
            content: function(value) {
                return layedit.sync(content);
            }

        });
        //监听 向父页面传值
        $(document).on('click',"#sontodad",function(){
          var values = $("#demo").val();
          //调用父页面函数，并把刚刚输入的值传递到子页面
          parent.ppp(values); 
          //关闭 子页面
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);
        });
      });
    }
  </script>
</body>
</html>

